package lanou.autohome.recommend.fragments;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import lanou.autohome.basetool.BaseFragment;
import lanou.autohome.basetool.NetTool;
import lanou.autohome.R;
import lanou.autohome.URLValues;
import lanou.autohome.recommend.adapters.EvaluationAdapter;
import lanou.autohome.recommend.beans.EvaluationBean;

/**
 * Created by dllo on 16/8/15.
 * 推荐 -> 文化  和  改装/技术一样(没有找到区分布局的点,与测评/用车/游记,共用一个Adapter和bean)
 */
public class CultureFragment extends BaseFragment {

    private RecyclerView recyclerView;
    private EvaluationAdapter evaluationAdapter;

    @Override
    protected int setLayout() {
        return R.layout.fragment_recommend_evaluation;
    }


    @Override
    protected void initView() {

        recyclerView = bindVie(R.id.recyclerView_evaluation_recommend);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    }

    @Override
    protected void intiData() {
        evaluationAdapter = new EvaluationAdapter(getContext());

        mNetTool.getNetData(URLValues.CULTURE_URL, EvaluationBean.class, new NetTool.NetListener<EvaluationBean>() {
            @Override
            public void onSuccess(EvaluationBean evaluationBean) {
                evaluationAdapter.setBeans(evaluationBean);
                recyclerView.setAdapter(evaluationAdapter);
            }

            @Override
            public void onError(String errorMsg) {

            }
        });
    }
}
